import Cookies from 'js-cookie'
import area from '@/libs/area.json'
import util from '@/libs/util'
const user = {
    state: {
        info: {},
        areaData: util.changeAreaKey(area),
        customer: [],
        btnPower: []
    },
    mutations: {
        setbtnPower(state, btnPower) {
            state.btnPower = btnPower;
            localStorage.btnPower = JSON.stringify(btnPower);
        },
        setCustomer(state, customer) {
            state.customer = customer;
        },
        setAreaData(state, areaData) {
            state.areaData = areaData;
        },
        setOwnInfo(state, info) {
            state.info = info;
            localStorage.userInfo = JSON.stringify(info);
        },
        logout(state, vm) {
            Cookies.remove('uuid');
            localStorage.clear()
        }
    }
}
export default user